import { defineStore } from "pinia";
import { refreshToken } from "../api/login";


export const useUserStore = defineStore("user", {
    state: () => {
        return {
            token: '',
            refreshToken:'',
            permission: []
        }
    },
    getters: {

    },
    actions: {


        login(token) {
            this.token = token;
        },
        logout() {
            this.token = null;
        },
        setPermission(permission) {
            this.permission = permission
        }
    },
    persist: [
        {
            pick: ['token'],
            storage: localStorage,
        }
    ]
})